//
//  LTMineAPIManager.m
//  LearnTeacher
//
//  Created by zyl_macbookpro on 2024/4/11.
//

#import "LTMineAPIManager.h"

@implementation LTMineAPIManager
+ (void)getUserInfoWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_USERINFO_URL];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
        if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)upLoadHeadImageWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_UPLOAD_URL];
    UIImage *img = param[@"img"];
    [BaseRequest baseUpload:url parms:@{} imageList:@[img] cache:NO autoHideLoading:YES progress:^(NSProgress * _Nonnull downloadProgress) {
            
        } result:^(id resultObject, NSError *error) {
            if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
                resultBlock(resultObject);
            }
            
        }];
}
+ (void)changeUserInfoWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_PROFILE_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)getConnectInfoWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_CONNECTUS_URL];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)addFeedbackWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_FEEDBACK_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)resetPwdWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_RESETPWD_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)changePhoneNumberWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_CHANGEPN_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
        resultBlock(resultObject);
    }];
}
+ (void)sendSMSWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_SMSSEND_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
        if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
             resultBlock(resultObject);
         }else{
             NSDictionary *dic = (NSDictionary *)resultObject;
             [SVProgressHUD showImage:nil status:dic[@"msg"]];
         }
    }];
}
+ (void)getTeacherAboutWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,MINE_About_URL];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
@end
